package com.wntms.ft.dao;

import com.wntms.ft.pojo.FareForm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IndexDao {

    /**
     * 查询总条数
     * @return
     */
    @Select("select count(*) from carriage_contract")
    public int findAllOrder();

    /**
     * 查询未发货订单
     * @return
     */
    @Select("select count(*) from freight_status where status=0")
    public int findWaitSendOrder();

    /**
     * 查询运输中的订单
     * @return
     */
    @Select("select count(*) from freight_status where status in(1,2,3,4)")
    public int transitOrder();

    /**
     * 查询已完成订单
     * @return
     */
    @Select("select count(*) from freight_status where status =5")
    public int finishedOrder();

    /**
     * 运费排行榜
     * @return
     */
    @Select("SELECT senderid AS id,SUM(fare) AS fare FROM carriage_contract\n" +
            "\t GROUP BY senderid\n" +
            "\tORDER BY fare DESC\n" +
            "\tLIMIT 0,5")
    public List<FareForm> findAllFare();

    @Select("select name from customer_information where id = #{id}")
    public String findNameById(int id);





}
